/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package OrchestrationLanguage.impl;

import OrchestrationLanguage.Argument;
import OrchestrationLanguage.OrchestrationLanguagePackage;
import OrchestrationLanguage.Variable;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Argument</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link OrchestrationLanguage.impl.ArgumentImpl#getAssignFrom <em>Assign From</em>}</li>
 *   <li>{@link OrchestrationLanguage.impl.ArgumentImpl#getAssignTo <em>Assign To</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ArgumentImpl extends EObjectImpl implements Argument {
	/**
	 * The cached value of the '{@link #getAssignFrom() <em>Assign From</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAssignFrom()
	 * @generated
	 * @ordered
	 */
	protected Variable assignFrom;

	/**
	 * The cached value of the '{@link #getAssignTo() <em>Assign To</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAssignTo()
	 * @generated
	 * @ordered
	 */
	protected Variable assignTo;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ArgumentImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return OrchestrationLanguagePackage.Literals.ARGUMENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Variable getAssignFrom() {
		if (assignFrom != null && assignFrom.eIsProxy()) {
			InternalEObject oldAssignFrom = (InternalEObject)assignFrom;
			assignFrom = (Variable)eResolveProxy(oldAssignFrom);
			if (assignFrom != oldAssignFrom) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, OrchestrationLanguagePackage.ARGUMENT__ASSIGN_FROM, oldAssignFrom, assignFrom));
			}
		}
		return assignFrom;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Variable basicGetAssignFrom() {
		return assignFrom;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAssignFrom(Variable newAssignFrom) {
		Variable oldAssignFrom = assignFrom;
		assignFrom = newAssignFrom;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, OrchestrationLanguagePackage.ARGUMENT__ASSIGN_FROM, oldAssignFrom, assignFrom));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Variable getAssignTo() {
		if (assignTo != null && assignTo.eIsProxy()) {
			InternalEObject oldAssignTo = (InternalEObject)assignTo;
			assignTo = (Variable)eResolveProxy(oldAssignTo);
			if (assignTo != oldAssignTo) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, OrchestrationLanguagePackage.ARGUMENT__ASSIGN_TO, oldAssignTo, assignTo));
			}
		}
		return assignTo;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Variable basicGetAssignTo() {
		return assignTo;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAssignTo(Variable newAssignTo) {
		Variable oldAssignTo = assignTo;
		assignTo = newAssignTo;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, OrchestrationLanguagePackage.ARGUMENT__ASSIGN_TO, oldAssignTo, assignTo));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case OrchestrationLanguagePackage.ARGUMENT__ASSIGN_FROM:
				if (resolve) return getAssignFrom();
				return basicGetAssignFrom();
			case OrchestrationLanguagePackage.ARGUMENT__ASSIGN_TO:
				if (resolve) return getAssignTo();
				return basicGetAssignTo();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case OrchestrationLanguagePackage.ARGUMENT__ASSIGN_FROM:
				setAssignFrom((Variable)newValue);
				return;
			case OrchestrationLanguagePackage.ARGUMENT__ASSIGN_TO:
				setAssignTo((Variable)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case OrchestrationLanguagePackage.ARGUMENT__ASSIGN_FROM:
				setAssignFrom((Variable)null);
				return;
			case OrchestrationLanguagePackage.ARGUMENT__ASSIGN_TO:
				setAssignTo((Variable)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case OrchestrationLanguagePackage.ARGUMENT__ASSIGN_FROM:
				return assignFrom != null;
			case OrchestrationLanguagePackage.ARGUMENT__ASSIGN_TO:
				return assignTo != null;
		}
		return super.eIsSet(featureID);
	}

} //ArgumentImpl
